import socket
#1.创建socket对象
serve_socket=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#2.绑定ip地址和端口
serve_socket.bind(('127.0.0.1',8888))

while True:
    #3.接收发过来的数据
    recv_data,addr=serve_socket.recvfrom(1024)
    print('客户发过来的数据为：',recv_data.decode('utf-8'))
    if recv_data.decode('utf-8')=='bye':
        break
    data1=input('客服说：')
    serve_socket.sendto(data1.encode('utf-8'),addr)
#4.关闭socket对象
serve_socket.close()